<template>
  <div class="tuikuan">
    <div class="pageHeader">
      退款成功
    </div>
    <div class="header">
      <div class="container acea-row row-column-between">
        <div class="item acea-row">
          <span class="title">退款原因</span>
          <p>{{orderDetail.refund_reason}}</p>
        </div>
        <div class="item acea-row">
          <span class="title">退款发起方</span>
          <p v-if="orderDetail.refund_type==1">客户</p>
          <p v-if="orderDetail.refund_type==2">{{orderDetail.course.title}}</p>
          <p v-if="orderDetail.refund_type==3">平台</p>
        </div>
      </div>
    </div>
    <div class="part01">
      <div class="item item01 acea-row row-middle row-between">
        <div class="priceTitle acea-row row-middle">
          <van-icon name="gold-coin" size="18" color="#2d8aea" />
          <span>退款总金额</span>
        </div>
        <p style="color:#ff6600">￥ {{orderDetail.payer_refund}}</p>
      </div>
      <div class="item acea-row row-middle row-between">
        <span class="title">退回{{orderDetail.user_received_account}}</span>
        <p>￥ {{orderDetail.payer_refund}}</p>
      </div>
    </div>
    <div class="part02">
      <div class="item acea-row row-middle row-between">
        <div class="acea-row row-middle">{{orderDetail.member_phone}}({{orderDetail.player_num}}人) <van-icon name="orders-o" size="16" style="margin-left:5px" @click="memberList = true"/></div>
        <!-- <div>￥650 x 3</div> -->
      </div>
      <div class="item acea-row row-middle">
        <p style="font-weight: bold;">{{orderDetail.play_time | changeTime}}</p>
        <p style="color:#cccccc;margin:0 5px">/</p>
        <p>{{orderDetail.course.title}}</p>
      </div>
      <div class="item acea-row row-middle">
        <p class="title">申请时间</p>
        <p>{{orderDetail.refund_create_time | changeTime}}</p>
      </div>
      <div class="item acea-row row-middle">
        <p class="title">订单号</p>
        <p style="flex:1">{{orderDetail.order_number}}</p>
        <span style="color:#1989fa" v-clipboard:copy="orderDetail.order_number" v-clipboard:success="copySuccess">复制</span>
      </div>
    </div>

    <div class="footer acea-row row-middle">
      <a href="tel:13970909726" class="item left acea-row row-middle row-center">
        <van-icon name="audio" size="18" />
        <span>联系客服</span> 
      </a>
      <a :href="'tel:'+orderDetail.course.phone" class="item right acea-row row-middle row-center">
        <van-icon name="manager" size="18" />
        <span>联系球场</span> 
      </a>
    </div>

    <div class="memberList">
      <van-dialog v-model="memberList" title="预订" :showConfirmButton="false" :closeOnClickOverlay="true">
        <ul>
          <li v-for="(item,index) in orderDetail.player " :key="index">
            <span v-if="item.is_vip == 0">嘉宾</span>
            <span v-else-if="item.is_vip == 1" style="background: #6ECF9D">会员</span>
            {{ item.name }}
            {{ item.telphone }}
          </li>
        </ul>
      </van-dialog>
    </div>
  </div>
</template>

<script>
import Vue from 'vue';
import api from 'api'
import moment from 'moment'
import config from 'api/config.js'
import { Step, Steps , Dialog , Icon, Toast } from 'vant';
Vue.use(Step);
Vue.use(Steps);
Vue.use(Dialog);
Vue.use(Icon);

export default {
  data() {
    return {
      memberList:false,
      orderDetail:{
        course:{},
        player:[]
      }
    }
  },
  created() {
    this.getDetail()
  },
  methods: {
    getDetail(){
      let order_id = this.$route.params.id
      this.order_id = order_id
      Toast.loading({message:"加载中...",duration:5000})
      api.get("/notice/orderRefund",{order_id}).then(e=>{
        this.orderDetail = e.data
        Toast.clear()
      })
    },
    copySuccess(){
      Toast("复制成功")
    }
  },
  filters:{
    changeTime(e){
      return moment(e*1000).format("YYYY-MM-DD HH:mm:ss")
    }
  }
}
</script>

<style scoped>
  .tuikuan{
    min-height: 100vh;
    background-color: #f2f3f5;
    position: relative;
  }
  .header{
    /* height: 220px; */
    background-image: linear-gradient(#5494fb,#4e70ea);
    overflow: hidden;
    font-size: 26px;
  }
  .header .container{
    width: 700px;
    /* height: 150px; */
    background-color: #ffffff;
    margin: 35px auto;
    border-radius: 20px;
    padding: 30px;
    box-sizing: border-box;
  }
  .header .container .item{
    margin-bottom: 20px;
    flex-wrap: nowrap;
  }
  .header .container .item:last-of-type{
    margin-bottom: 0;
  }
  .header .container .title{
    color: #2d8aea;
    margin-right: 20px;
    white-space: nowrap;
  }
  .part01{
    padding: 30px 20px;
    background-color: #ffffff;
    font-size: 26px;
  }
  .part01 .item{
    margin-bottom: 20px;
  }
  .part01 .item:last-of-type{
    margin-bottom: 0;
  }
  .part01 .item01{
    font-size: 30px;
  }
  .part01 .item .priceTitle span{
    color: #2d8aea;
    margin-left: 10px;
  }
  .part01 .item .title{
    margin-left: 45px;
  }
  .part02{
    padding: 30px;
    background-color: #ffffff;
    font-size: 26px;
    margin-top: 20px;
  }
  .part02 .item{
    margin-bottom: 20px;
  }
  .part02 .item:last-of-type{
    margin-bottom: 0;
  }
  .part02 .item .title{
    color: #9b9b9b;
    margin-right: 40px;
  }
  .footer{
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 90px;
    font-size: 26px;
  }
  .footer .item{
    width: 50%;
    height: 100%;
    color: #ffffff;
  }
  .footer .left{
    background-color: #6ecf9d;
  }
  .footer .right{
    background-color: #2d8aea;
  }
  .footer .item span{
    margin-left: 20px;
    margin-top: 4px;
  }
  .memberList >>> .van-dialog__content{
    max-height: 240px;
    overflow-y: auto;
    padding: 0 10px;
  }
  .alertContent >>> .van-dialog__header , .memberList >>> .van-dialog__header {
    padding: 10px 0;
    background: #F2F3F5;
  }

  .memberList ul {
    padding-bottom: 20px;
  }

  .memberList li {
    display: flex;
    justify-content: center;
    align-items: center;
    line-height: 80px;
    background: #ffffff;
    border-bottom: 1px solid #cccccc;
  }

  .memberList li span {
    width: 80px;
    height: 40px;
    line-height: 40px;
    text-align: center;
    color: #ffffff;
    background: #cccccc;
    font-size:28px;
    border-radius: 10px;
    margin-right: 10px;
  }
</style>